The invention is directed to a method for processing image data, particularly in printer, whereby a source image to be processed contains source picture elements arranged matrix-like to which a respective source image datum is allocated, this determining the presentation of the respective source picture element. A target image arising in the further-processing of the source image data contains target picture elements arranged matrix-like to which a respective target image datum is allocated, this defining the presentation of the respective target picture element.
Such methods are called scaling methods and are utilized, for example, in printers when target image data of a print image or, respectively, target image are produced from the source image data of a source image, said target image being expanded or compressed in line direction compared to the source image or, respectively, having a higher or lower resolution in line direction than the source image. A scaling factor thereby indicates the ratio between target image resolution and source image resolution in a specific image direction.
When, for example, scaling is carried out line-by-line, then a line factor is prescribed as scaling factor that defines the ratio of the number of line picture elements per line of the target image relative to the number of source picture elements per line of the source image. The line factor sometimes has a value that is not a whole number. When a target image having a resolution of 600 dpi in line direction is to be produced from a source image having a resolution of 240 dpi (picture elements per 25.4 mm) in line direction, then the line factor has, for example, the value 2.5. The line factor likewise has the value 2.5 when, given the same size of the source picture elements and the target picture elements, a target image is to be produced from the source image whose extent in line direction amounts to 2.5 times the value of the extent of the source image in line direction. In other words, the source image is stretched by the factor 2.5 in line direction.
The line factor is less than 1 when a target image having reduced resolution in line direction is produced from the source image or when the target image is compressed in sine direction compared to the source image.
A method that implements a transformation of the locus coordinates between source image and target image is known, for example, for generating the target data. In this method, however, a plurality of multiplications and similar operations are implemented that require a plurality of processor clocks.
U.S. Pat. No. 4,275,450 discloses a method and a circuit arrangement for enlarging or reducing images wherein the image data are selectively sluiced through a plurality of processing stages.
DE 34 18 624 C2 discloses a scaling method wherein image data are converted line-by-line from a first raster into a second raster having different resolution. For demagnifying images (scaling factor less than 1), an initial value (for example, 5/16) is first set in an address counter, and the counter is incremented by a specific value (for example 5/8) with each processing step. Whenever the address counter exceeds a comparison value (for example 1), the current image datum is transferred into a buffer memory. The comparison value is thereby higher than the initial value. What is disadvantageous about this type of scaling is that the outermost picture elements at the image edgesxe2x80x94particularly the first picture element at the beginning of the linexe2x80x94are suppressed because the initial value (5/8) is lower than the comparison value. This leads to image falsifications; in particular, edge lines having a width of one picture are not reproduced in the target image.
An object of the invention is to achieve a high processing speed and a true-to-the-original reproduction in the target image when scaling image data.
This object is inventively achieved by a procedure having the features of patent claims 1, 2, 4 and 15as well as by a circuit arrangement having the features of patent claim 13 . Advantageous embodiments of the invention are recited in the subclaims.
According to the invention, a scaling variable is cyclically compared to a comparison value and, dependent on the comparison result, a decision is made as to whether a source image datum is accepted as target image datum. One thereby proceeds from a start value that is defined such that the first source picture datum is respectively accepted as target image datum under a predetermined comparison criterion in a group of source image data, for instance in an image row or in an image column.
When a source image datum has been taken as target image datum, the scaling variable is either added or subtracted by a constant value, particularly by the value one. When a source image data was not accepted as target image datum, the scaling variable is either subtracted or added by the scaling factor. The subtraction or, respectively, additions in both instances of the transfer behave mutually in the invention; when subtraction is carried out in the case of the data transfer, then adding is carried out in the case of non-transfer and vice versa.
In a preferred embodiment of the invention, the start value is identical to the scaling factor, the comparison value is zero, the value one is employed as constant and this is cyclically subtracted from the scaling variable. In another preferred embodiment of the invention, the start value is identical to the scaling factor, the comparison value is zero, the value one is employed as constant, and this is cyclically added to the scaling variable.
The invention is based on the consideration that the production of the target image is especially simple when only addition and subtraction operations are employed insofar as possible upon implementation of the method or, respectively, calculating operations whose execution requires only one clock or only a few clocks in a digital circuit arrangement. Particularly in a printer, the image data are successively transmitted to a print head. The method must therefore be designed such that an additional intermediate storage of the image data is avoided.
A high processing speed is achieved by assigning a scaling factor and by the following, cyclical processing of the source image data. In that a value whereat the first image datum is accepted is prescribed as start value, for example the first source image data of a row or column as first target image datum, the picture elements of the image lying at the start are correctly reproduced in any case, namely independently of the specific scaling factor (expansion or compression). Given an expansion of the image, at least the two first picture elements of a row or, respectively, the first two rows of an image are transferred into the target image data. The reproduction veracity in these edge regions is therefore significantly improved to the aforementioned and known methods. This advantage is particularly felt given graphic edge lines of images.
The invention is particularly suited for employment in a hard-wired, electronic circuit or in a user-specific integrated circuit (ASIC). A pipeline structure is particularly advantageous given such a circuit, the source image data being loaded therein from a first memory via a first data line into a control circuit for the execution of calculations and comparisons, and the calculated, target image data being deposited in a following, second memory. The second memory is connected to the control circuit via a second line that is separate from the first line. This arrangement allows a high processing speed because the loading and storing of the source or, respectively, target image data can ensue parallel in time.
Given a line-by-line, cyclical image data processing according to the invention, the source image data for successive source picture elements of at least one line of the source image are successively processed. The scaling factor here indicates the ratio of the number of target picture elements per line of the target image relative to the number of source picture elements per line of the source image. The line-by-line processing enables the processing of data stream of successive source image data without additional intermediate storing or, respectively, with only a small buffer memory for matching the processing speed to the speed of the occurrence of the source image data.
Given the line-by-line method according to the invention, the line factor is employed as start value for a line variable. Subsequently, the following steps are cyclically implemented:
a) when the momentary value of the line variable is greater than zero, the source image datum processed at the moment is copied and employed as target image datum; further, the momentary value of the line variable is reduced by the numerical value xe2x80x9c1xe2x80x9d;
b) when the momentary value of the line variable is not greater than zero, the next source image datum is employed instead of the source image datum processed at the moment; further, the value of the line factor is added to the momentary value of the line variable.
Only interrogation operations, copying events, subtractions and additions need be carried out in step a and b. These operations require only a few clocks in a processor or, respectively, in a clocked circuit arrangement that does not process a program. In the subtraction, only the value xe2x80x9c1xe2x80x9d is subtracted, so that a deincrementation counter is also employed. The method of the invention can thus be implemented at high speed. The method of the invention is also simple because it contains essentially only two different method steps.
In the method of the invention, target image data for successive target picture elements of a row of the target image arise in succession. The target image data can be successively transmitted to the print head of a printer as target image data stream or can be stored in a buffer memory for further operations.
The invention can also be employed as a method operating column-by-column for processing image data, whereby a column factor is prescribed that determines the ratio of the number of target picture elements per column of the target image relative to the number of source picture elements per column of the source image. Column-by-column in this context means that the column is composed of whole lines of the source image or, respectively, of the target image. Steps that are essentially similar to the line-by-line method of the invention are implemented given the column-by-column method of the invention. The above considerations and technical effects thus also apply to the method functioning column-by-column according to the invention. However, column-by-column methods of the invention employ the column factor instead of the line factor and a column variable instead of the line variable.
Given the column-by-column method, the source image data are successively processed for successive lines of the source image. Target image data for target picture elements of a line of the target image are thereby generated according to a predetermined line processing method from the momentarily processed source image data for a line of the source image. In the predetermined line processing method, the source image data of a line are copied in the simplest case and employed as target image data of a target image line. In this case, the line factor, however, has the value xe2x80x9c1xe2x80x9d.
In a development of the column-by-column method, the target image data are only generated according to the predetermined line processing method when target image data according to the line processing method have not yet been produced for is the source image data processed at the moment. When line image data were already produced, then a copy of these line image data is employed. This assumes that the line image data of a line of the target image generated according to the line processing method are stored until line image data of a new line are generated with the line processing method for other source image data. The storing of target image data for a line of the target image is preferably implemented when the column factor has a value greater than one. A repeated implementation of the line processing method for processing the same source image data of a line is avoided by storing the target image data. A copying of the target image data can be implemented faster than a re-calculation. The entire method thus also becomes faster.
In another development of the column-by-column method of the invention, the predetermined line processing method for processing source image date of a line essentially coincides with the line-by-line method of the invention. I.E., in addition to the method steps recited in patent claim 1, the method steps recited in patent claim 1, [sic] are implemented in order to generate the target image data of a line. As a result of this measure, a uniform method derives for the expansion and compression or, respectively, for increasing the resolution and diminishing the resolution both in line direction as well as in column direction. In this method, the column factor and the line factor can be selected independently of one another.
The subtraction of the value 1 and the adding of the line factor or, respectively, of the column factor to the line variable or, respectively, column variable is advantageously implemented such that the operations are implemented separately for the pre-decimal point value and the post-decimal point value of the line variable or, respectively, the column variable. As a result of this measure, two adders having a bit width of 16 bits can be employed instead of one adder having, for example, 32 bits. This is particularly advantageous when the clock frequency for two smaller adders is lower than for one larger adder in an integrated circuit, for example in an ASIC (application-specific integrated circuit).
Given a separate processing of the pre-decimal point value and post-decimal value, the pre-decimal point value can be processed as counter value in a counter since it need always be diminished only by the numerical value 1 . A counter can be constructed with less circuit-oriented outlay than an adder or subtraction.
The separation into pre-decimal point value and post-decimal value in the processing of the line variable and/or of the column variable advantageously allows an adder for whole-numbered additions to be employed for the post-decimal point value. Such an adder can be more simply realized in circuit-oriented terms than an adder for rational numbers, i.e. numbers with a decimal point.
In another advantageous embodiment of the invention, the target image data of a plurality of groups of target image data are produced given a scaling factor that is higher than 1, being produced from the source image data of a group of source image data being processed at the moment in that only one group of target image data is generated from the group of source image data, this is stored and subsequently copied until the next group of source image data is processed. One line, in particular, is employed as group. A repetition of calculating events can thereby avoided and, consequently, the processing speed for the data of an overall image can be increased.
The aforementioned technical effects and advantages of the inventive method also apply to the corresponding circuit arrangements.